/*
 * Copyright (c) 2021. Moses All Right Reserved
 */

package com.moses.design_patterns.proxy.static_proxy.abstract_proxy;

/**
 * @author Moses
 * @email shenhuohui@gmail.com
 * @date 2021/4/10 18:18
 */
public class SubjectProxy extends AbstractSubject {

    private AbstractSubject subject = null;

    private  void before(){
        System.out.println("事前处理");
    }

    private void after(){
        System.out.println("事后处理");
    }

    public SubjectProxy(){
        // 决定代理谁
        subject = new RealSubject();
    }

    @Override
    public void method() {
        before();
        subject.method();
        after();
    }
}
